#include "occi.h"
#include <string>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <stdio.h>
using namespace oracle::occi;
using namespace std;
int main(int argc,char *argv[])
{
	string usr = "liu";
	string pwd = "liu";
	string db = "XE";

	int i_to_search = 100; 
	char strSQL[512] = {0};

	Environment *env = Environment::createEnvironment(Environment::DEFAULT);

	Connection *conn = env->createConnection(usr.c_str(),pwd.c_str(),db.c_str());

	Statement *stmt = conn->createStatement();
    stmt->setSQL("BEGIN MY_COUNT(:1); END;");

	//stmt->setInt(1,i_to_search);
    stmt -> registerOutParam(1, OCCIINT);
	ResultSet *rs = NULL;
	try
	{
		int updatecount = stmt->execute();
        printf("[%d]\n", stmt->getInt(1));
	}
	catch(SQLException e)
	{
		cout<<"SQLException catched:"<<e.what()<<endl;
	}

	conn->terminateStatement(stmt);
	env->terminateConnection(conn);
	Environment::terminateEnvironment(env);
	return 0;
}

